Sprite Track Properties
In addition to defining properties for individual sprites, you can also define properties that apply to an entire sprite track. These properties may override default behavior or provide hints to the sprite media handler. The following sprite track properties are supported:
-
The
kSpriteTrackPropertyBackgroundColor
property specifies a background color for the sprite track. The background color is used for any area that is not covered by regular sprites or background sprites. If you do not specify a background color, the sprite track uses black as the default background color.
-
The
kSpriteTrackPropertyOffscreenBitDepth
property specifies a preferred bit depth for the sprite track's offscreen buffer. The allowable values are 8 and 16. To save memory, you should set the value of this property to the minimum depth needed. If you do not specify a bit depth, the sprite track allocates an offscreen buffer with the depth of the deepest intersecting monitor.
-
The
kSpriteTrackPropertySampleFormat
property specifies the sample format for the sprite track. If you do not specify a sample format, the sprite track uses the default format,
kKeyFrameAndSingleOverride
.
For wired sprites, which are discussed in
Chapter 1, "Introduction to Wired Movies, Sprites, and the Sprite Toolbox,"
the following sprite track properties are supported:
-
The
SpriteTrackPropertyHasActions
property.
You must add an atom of this type with its leaf data set to
true
if
you want the movie controller to execute the actions in your sprite track's media. The atom's leaf data is of type Boolean. The default value is
false
, so it is very important to add an atom of this type if you want interactivity to take place.
-
The
kSpriteTrackPropertyQTIdleEventsFrequency
property. You must add an atom of this type if you want the sprites in your sprite track to receive
kQTEventIdle
QTEvents. The atom's leaf data is of type
UInt32
.
The value is the mimimum number of ticks that must pass before the next
QTIdle
event is sent
. Each tick is 1/60th of one second. For more information, see
"Sprite Track Property Atoms" (page 160)
.
-
The
kSpriteTrackPropertyVisible
property.
You may cause the entire sprite track to be invisible by setting the value of this Boolean property to
false
. This is useful for using a sprite track as a hidden button track--for example, placing an invisible sprite track over a video track would allow the characters in the video to be clicked on. The default value is visible (
true
).
-
The
kSpriteTrackPropertyScaleSpritesToScaleWorld
property. You may cause each sprite to be rescaled when the sprite track is resized by setting the value of this Boolean property to
true
. Setting this property can improve the drawing performance of a scaled sprite track. This is particularly useful for sprite images compressed with codecs which are resolution-independent, such as the Curve codec. The default value for this property is
false
.
To specify sprite track properties, you create a single QT atom container and add a leaf atom for each property you want to specify. To add the properties to a sprite track, you call the new media handler function
SetMediaPropertyAtom
. To retrieve a sprite track's properties, you call the media handler function
GetMediaPropertyAtom
.
The sprite track properties and their corresponding atom data are outlined in
Table 2-1
.
Table 1
Sprite track properties
Atom type
|
Atom ID
|
Leaf data type
|
kSpriteTrackPropertyBackgroundColor
|
1
|
RGBColor
|
kSpriteTrackPropertyOffscreenBitDepth
|
1
|
unsigned short
|
kSpriteTrackPropertySampleFormat
|
1
|
long
|
kSpriteTrackPropertyHasActions
|
1
|
Boolean
|
kSpriteTrackPropertyQTIdleEventsFrequency
|
1
|
UInt32
|
kSpriteTrackPropertyVisible
|
1
|
Boolean
|
kSpriteTrackPropertyScaleSpritesToScaleWorld
|
1
|
Boolean
|
When pasting portions of two different tracks together, the Movie Toolbox checks to see that all sprite track properties match. If, in fact, they do match, the paste results in a single sprite track instead of two.
© 1999 Apple Computer, Inc.| Previous | Chapter Contents | Chapter Top | Next |